<div style="width:1030px; height:520px; margin-left:17px;">
  <div id="pages" class="rel" style="width:618px; height:558px; padding:0; background:#fff <?php if ($filename){ echo 'url('.$this->base.'/img/cms/'.$filename.')'; }; ?> center center no-repeat;">
<?php if ($admin) { ?>
    <div class="abs" style="background-color:#DCDDDF; padding:5px; bottom:5px; right:5px;">
      <form id="upload-form1" name="upload-form" enctype="multipart/form-data" method="post" action="<?php echo $this->base; ?>/pages/axUpload/aboutus">
        <div><?php __('Upload Content'); ?>:</div>
        <input type="file" id="uploadImage1" name="uploadImage" onchange="doUploadImage(1)" />
        <div id="uploadBar1" class="uploadBar" style="display:none;"></div>
        <div id="messageBox1" class="boxError" style="display:none;"></div>
    </form>
    </div>
<?php } ?>
  </div>
  <div class="fLeft" style="height:468px; margin-left:15px;">
    <div id="pages2" class="rel" style="width:202px; height:226px; margin-bottom:15px; background:#fff <?php if ($filename2){ echo 'url('.$this->base.'/img/cms/'.$filename2.')'; }; ?> center center no-repeat;">
<?php if ($admin) { ?>
    <div class="abs" style="background-color:#DCDDDF; padding:5px; bottom:5px; right:5px;">
      <form id="upload-form2" name="upload-form" enctype="multipart/form-data" method="post" action="<?php echo $this->base; ?>/pages/axUpload/aboutus2">
        <div><?php __('Upload Content'); ?>:</div>
        <input type="file" id="uploadImage2" name="uploadImage" onchange="doUploadImage(2)" />
        <div id="uploadBar2" class="uploadBar" style="display:none;"></div>
        <div id="messageBox2" class="boxError" style="display:none;"></div>
    </form>
    </div>
<?php } ?>
    </div>
    <div style="background-color:#fff; width:162px; height:257px; padding:30px 20px;">
<?php foreach ($links as $l) {
          if ($l['Link']['name'] && $l['Link']['link']) { ?>
      <p><a href="<?php e($l['Link']['link']); ?>" class="title" target="_blank"><?php e($l['Link']['name']); ?></a></p>
<?php     }
      } ?>
    </div>
  </div>
  <div class="clear"></div>
</div>

<script type="text/javascript">
var _webroot = '<?php e($this->base); ?>';
<?php if ($admin) { ?>
function doUploadImage (no) {
    var errorMesg = '<h4>Please select an image from your computer.</h4>';
    var mesgBox   = Ext.get('messageBox'+no);

    if (!Ext.fly('uploadImage'+no).getValue()) {
        mesgBox.update(errorMesg);
        Ext.fly('uploadImage'+no).highlight().focus();
        return false;
    } else if (mesgBox.isVisible()) {
        mesgBox.fadeOut({
            easing: 'easeOut',
            useDisplay: true
        });
    }

    Ext.fly('uploadImage'+no).setStyle({  display:'none' });
    Ext.fly('uploadBar'+no).fadeIn();

    if (no == 1) {
        AIM.submit(Ext.fly('upload-form'+no).dom, { 'onComplete':completeCallback });
    } else {
        AIM.submit(Ext.fly('upload-form'+no).dom, { 'onComplete':completeCallback2 });
    }

    Ext.fly('upload-form'+no).dom.submit();
    Ext.fly('uploadImage'+no).dom.value = '';

    Ext.fly('status').update('Uploading..');
        Ext.fly('status').slideIn('t', {
            easing: 'easeOut'
    });
} // doUploadImage

function completeCallback (response) {
    var json = Ext.decode(response);

    Ext.fly('uploadBar').setStyle({  display:'none' });
    Ext.fly('uploadImage').fadeIn();
    Ext.fly('status').slideOut('t', {
        easing: 'easeOut',
        useDisplay: true
    });

    if (json.status < 0) {
        var err = (json.message) ? json.message : 'Fail upload photo';
        Ext.fly('messageBox').highlight().update(err);
    } else if (json.status == 1) {
        Ext.fly('pages').setStyle({ backgroundImage:'url('+_webroot+'/img/cms/'+json.filename+')' });
        Ext.fly('pages').fadeIn({ easing:'easeOut' });
    }
} // completeCallback

function completeCallback2 (response) {
    var json = Ext.decode(response);

    Ext.fly('uploadBar2').setStyle({  display:'none' });
    Ext.fly('uploadImage2').fadeIn();
    Ext.fly('status').slideOut('t', {
        easing: 'easeOut',
        useDisplay: true
    });

    if (json.status < 0) {
        var err = (json.message) ? json.message : 'Fail upload photo';
        Ext.fly('messageBox2').highlight().update(err);
    } else if (json.status == 1) {
        Ext.fly('pages2').setStyle({ backgroundImage:'url('+_webroot+'/img/cms/'+json.filename+')' });
        Ext.fly('pages2').fadeIn({ easing:'easeOut' });
    }
} // completeCallback2
<?php } ?>
</script>